package com.huaxin.device.dto.request;

import com.huaxin.device.dto.enums.validation.ValidAlarmLevel;
import com.huaxin.device.dto.enums.validation.ValidAlarmType;
import com.huaxin.hxenum.validation.ValidComparisonOperator;
import com.huaxin.hxenum.validation.ValidEquipmentDataType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;


@Data
public class AlarmThresholdRuleUpdateReqDTO {

    @NotBlank(message = "ID不能为空")
    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "876e5432-e12d-32c1-b654-321098765432")
    private String id;

    /**
     * 所属模板ID
     */
    @Schema(description = "所属模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "876e5432-e12d-32c1-b654-321098765432")
    @NotBlank(message = "模板ID不能为空")
    private String templateId;

    /**
     * 报警类型
     */
    @Schema(description = "报警类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "over_current")
    @NotNull(message = "报警类型不能为空")
    @ValidAlarmType
    private String alarmType;

    /**
     * 监控字段，数据源是EquipmentDataType
     */
    @Schema(description = "监控字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "voltage_a_kv")
    @NotBlank(message = "监控字段不能为空")
    @ValidEquipmentDataType
    private String metricField;

    /**
     * 比较操作
     */
    @Schema(description = "比较操作", requiredMode = Schema.RequiredMode.REQUIRED, example = "gt")
    @NotNull(message = "比较操作不能为空")
    @ValidComparisonOperator
    private String comparisonOp;

    /**
     * 阈值
     */
    @Schema(description = "阈值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10.5")
    @NotBlank(message = "阈值不能为空")
    private String thresholdValue;

    /**
     * 单位
     */
    @Schema(description = "单位", example = "A")
    private String unit;

    /**
     * 报警等级
     */
    @Schema(description = "报警等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
    @NotNull(message = "报警等级不能为空")
    @ValidAlarmLevel
    private Integer alarmLevel;

    /**
     * 持续时间（秒）
     */
    @Schema(description = "持续时间（秒）", example = "10")
    private Integer durationSec;

    /**
     * 冷却时间（秒）
     */
    @Schema(description = "冷却时间（秒）", example = "300")
    private Integer cooldownSec;

    /**
     * 描述
     */
    @Schema(description = "描述", example = "电流超过10A触发报警")
    private String description;
}